

using BootstrapBlazor.Components;
using Identity.Models;

namespace Identity.Extensions;

public static class SelectedItemExtensions
{
   

    /// <summary>
    /// 
    /// </summary>
    /// <param name="roles"></param>
    /// <returns></returns>
    public static List<SelectedItem> ToSelectedItemList(this IEnumerable<Role> roles) => roles.Select(i => new SelectedItem { Value = i.Id!, Text = i.Name }).ToList();
 
   public static List<SelectedItem> ToSelectedItemList(this IEnumerable<User> users) => users.Select(i => new SelectedItem { Value = i.Id!, Text = i.ToString() }).ToList();
   public static List<SelectedItem> ToSelectedItemList2(this IEnumerable<User> users) => users.Select(i => new SelectedItem { Value = i.UserName!, Text =i.ToString() }).ToList();
    /// 
    /// </summary>
    /// <param name="dict"></param>
    /// <returns></returns>
    public static List<SelectedItem> ToSelectedItemList(this Dictionary<string, string> dict) => dict.Select(i => new SelectedItem { Value = i.Key, Text = i.Value }).ToList();
}